<?php
$TaskId = $_GET['task_id'] ?? '';

$dsn = "sqlsrv:Server=localhost;Database=Task";
$db = new PDO($dsn, "sa", "123456");

$sql = "delete from Task where TaskId='{$TaskId}'";
$result = $db->exec($sql);
var_dump($db->errorInfo());
if ($result) {
    echo '删除成功，前往<a href="list.php">列表页</a>';
} else {
    echo '删除失败';
}